//
//  ZGLHTTPRequestManager.h
//  ZeegingLottery
//
//  Created by 李曌 on 2018/7/4.
//  Copyright © 2018年 蒂埃里. All rights reserved.
//
//接口请求类

#import <Foundation/Foundation.h>
@class ZGLResponseInfo;

typedef NS_ENUM(NSInteger, ZGLRespondStatusCode){
    
    TT_E_ReturnDataNull                = -1,//返回数据错误
    TT_E_ConnectionError               = -2,//连接错误
    TT_E_DATA_INVALID                 = -3,//返回数据异常
    TT_E_NOT_NETWORK               = -4,//无网络
    SIGN_CHECK_ERROR                = -5, //签名验证错误
    MAC_CHANGE                          = -7, //mac地址改变
    NSTANCE_NULL                       = -8, //实例不存在
    TT_E_OK                                   = 0,//正常响应
    TT_E_FAIL_GET_DATA               = 1,//数据异常
    
};


typedef void(^HTTPRequestManagerSuccess)(id responseData);
typedef void(^HTTPRequestManagerFail)(ZGLRespondStatusCode bef_status,NSString *bef_message,NSError *error);

#define ZGL_SERVER_URL @"http://api.bybrain.cn" //域名

#define sZGLHTTPRequestManager [ZGLHTTPRequestManager sharedManager]

@interface ZGLHTTPRequestManager : NSObject

@property (nonatomic, copy)HTTPRequestManagerSuccess success;  //成功回调
@property (nonatomic, copy)HTTPRequestManagerFail fail;        //失败回调

+ (instancetype)sharedManager;



/*
  获取注册短信验证码
 
 @param mobile 手机号
 @param success 成功回调
 @param failure 失败回调
 */
- (void)getVerificationCodeWithPhoneNum:(NSString *)mobile
                                Success:(void(^)(void))success
                                   Fail:(HTTPRequestManagerFail)fail;

/**
 获取实名认证/绑定银行卡短信验证码

 @param sms_type 类型：1: 个人实名 3: 个人提现
 @param success 成功
 @param fail 失败
 */
- (void)getCertificationVerticodeWithSMSType:(NSString *)sms_type
                                Success:(void(^)(void))success
                                    Fail:(HTTPRequestManagerFail)fail;


/*
 注册
 
 @param mobile 手机号
 @param success 成功回调
 @param failure 失败回调
 @param password 密码
 @param smsVertifyCode 验证码
 @param registerChannel 注册渠道 //1 PC、2 IOS、3 Android,4 合作接口
 */

- (void)registWithMobilePhone:(NSString *)mobile
                     Password:(NSString *)password
                SmsVerifyCode:(NSInteger)smsVertifyCode
              RegisterChannel:(NSInteger)registerChannel
                      Success:(void (^)(id responseData))success
                         Fail:(HTTPRequestManagerFail)fail;

/*
 登录
 @param mobile 手机号
 @param success 成功回调
 @param failure 失败回调
 @param password 密码
 @param loginType 登录类型
 @param deviceName 登录设备名称
 @param deviceName 登录设备名称
 
 */
- (void)loginWithMobilPhone:(NSString *)mobile
                   Password:(NSString *)password
                  LoginType:(NSString *)loginType
                 DeviceName:(NSString *)deviceName
                DeviceModel:(NSString *)deviceModel
                    Success:(void(^)(id responseData))success
                       Fail:(HTTPRequestManagerFail)fail;

/*
 获取对战列表
 
 */
- (void)GetTheBattleListSuccess:(void(^)(id responseData))success
                           Fail:(HTTPRequestManagerFail)fail;



/**
 创建订单

 @param token 登录秘钥
 @param lotteryId 彩种ID
 @param content 投注内容 json格式的字符串
 @param darw 期号
 @param groupType 过关类型
 @param multiple 倍数
 @param amount 支付金额
 @param betNum 注数
 @param maxPrize 最大奖金
 @param minPrize 最小奖金
 @param success 成功回调
 @param fail 失败回调
 */
- (void)creatOrderWithToken:(NSString *)token
                  LotteryId:(NSString *)lotteryId
                    Content:(NSString *)content
                       Darw:(NSString *)darw
                  GroupType:(NSString *)groupType
                   Multiple:(NSString *)multiple
                     Amount:(NSString *)amount
                     BetNum:(NSString *)betNum
                   MaxPrize:(NSString *)maxPrize
                   MinPrize:(NSString *)minPrize
                    Success:(HTTPRequestManagerSuccess)success
                       Fail:(HTTPRequestManagerFail)fail;



/**
 获取订单列表

 @param status 订单状态
 @param token token
 @param success 成功回调
 @param fail 失败回调
 */
- (void)getOrderListWithStatus:(NSString *)status
                         Token:(NSString *)token
                       Success:(void(^)(id responsedata))success
                          Fail:(HTTPRequestManagerFail)fail;


/**
 余额支付

 @param number 订单号
 @param success 成功回调
 @param fail 失败回调
 */
- (void)useBalancePayWithOrderNum:(NSString *)number
                          Success:(void(^)(id responsedata))success
                             Fail:(HTTPRequestManagerFail)fail;


/**
 更新个人信息

 @param success 成功
 @param fail 失败
 */
- (void)UpdatePersonalInformationWithSuccess:(void(^)(id responsedata))success
                                        Fail:(HTTPRequestManagerFail)fail;


/**
 实名认证

 @param mobile 手机号
 @param code 短信验证码
 @param idCard 身份证号
 @param realName 真实姓名
 @param success 成功回调
 @param fail 失败回调
 */
- (void)RealNameAuthenticationWithMobile:(NSString *)mobile
                               VertiCode:(NSString *)code
                                  IdCard:(NSString *)idCard
                                RealName:(NSString *)realName
                                 Success:(void(^)(id responsedata))success
                                    Fail:(HTTPRequestManagerFail)fail;

/**
 绑定银行卡

 @param num 卡号
 @param location 开户所在地
 @param type 开户行
 @param success 成功
 @param fail 失败
 */
- (void)BankCardBindingWithNum:(NSString *)num
                      Location:(NSString *)location
                      bankType:(NSString *)type
                       Success:(void(^)(id responsedata))success
                          Fail:(HTTPRequestManagerFail)fail;


/**
 获取个人提现认证信息

 @param success 成功
 @param fail 失败
 */
- (void)getBankCardInfoWithSuccess:(void(^)(id responsedata))success
                              Fail:(HTTPRequestManagerFail)fail;


/**
 保存提现信息

 @param cash 提现金额
 @param code 验证码
 @param success 成功
 @param fail    失败
 */
- (void)extractCashComfirmWithCash:(NSString *)cash
                         VertiCode:(NSString *)code
                           Success:(void(^)(id responsedata))success
                              Fail:(HTTPRequestManagerFail)fail;


/**
 获取支付列表

 @param success 成功
 @param fail 失败
 */
- (void)getPaylistWithSuccess:(void(^)(id responsedata))success
                         Fail:(HTTPRequestManagerFail)fail;






/**
 获取预测赛果列表

 @param success 成功回调
 @param fail 失败回调
 */
- (void)getThePredictedResultsList:(void(^)(id responsedata))success
                              Fail:(HTTPRequestManagerFail)fail;



/**
 获取比赛情报内容

 @param matchId 比赛id
 @param success 成功回调
 @param fail 失败回调
 */
- (void)getMessageDataWithMatchID:(NSString *)matchId
                          Success:(void(^)(id responsedata))success
                             Fail:(HTTPRequestManagerFail)fail;


/**
 获取新闻数据列表

 @param success 成功回调
 @param fail 失败回调
 */
- (void)getNewsListDataSuccess:(void(^)(id responsedata))success
                          Fail:(HTTPRequestManagerFail)fail;


/**
 获取积分榜

 @param leagueid 联赛id
 @param success 成功回调
 @param fail 失败回调
 */
- (void)getScoreBoardListWithLeagueid:(NSInteger )leagueid
                              Success:(void(^)(id responsedata))success
                                 Fail:(HTTPRequestManagerFail)fail;

/**
 请求主界面数据

 @param success 成功回调
 @param fail 失败回调
 */
- (void)getMainPageDataSuccess:(void(^)(id responsedata))success
                          Fail:(HTTPRequestManagerFail)fail;



@end


@interface ZGLResponseInfo : NSObject

@property (nonatomic ,copy    ) NSURL *wholeQueryUrl;
@property (nonatomic, assign  ) NSInteger dataVersion;
@property (nonatomic, assign  ) NSInteger status;
@property (nonatomic, copy    ) NSString  *message;
@property (nonatomic, copy    ) id        data;

+ (void)requestFailedWithErrorCode:(ZGLRespondStatusCode)code
                        andMassage:(NSString *)msg
                      andErrorCode:(NSError *)error;

@end

